
-- procedure to delete a contact
-- return 1 if can delete, 0 cannot delete
IF OBJECT_ID('deleteContact') IS NOT NULL
BEGIN
	DROP PROCEDURE deleteContact;
END
GO
CREATE PROCEDURE deleteContact
	@contactId		INT
AS
BEGIN
	IF EXISTS(SELECT * FROM contact WHERE contactid=@contactId)
		BEGIN
			INSERT INTO backupContact(contactid,contact,contacttype)
			SELECT * FROM contact WHERE contactid=@contactId;
		END
END
GO